﻿Imports CObject
Imports ConnectionServer
Imports System.Data.SqlClient

Namespace CMT
    Public Class ParticipantRegistrationClass
        Inherits CObject.CObject

#Region "Constants"
        Public Const RegistrationCompleated As String = "Registration completed successfully."
        Public Const RegistrationPageAccessDenied As String = "You are not authorized to view this page."
        Public Const SelectParticipant As String = "Select a participant to register."
        Public Const NoQuestiondConfigured As String = "There are no questions configured for this event."
        Public Const NoParticipantsAdded As String = "There are no Participant added for this event."
        Public Const ArrDateLessThanDepDate As String = "The arrival date should be less than departure date, please correct the dates."
#End Region

        Public Sub New()
            MyBase.New()
        End Sub

        Public Sub New(ByVal piCode As Integer)
            MyBase.New(piCode)
        End Sub

        Public Overrides Function Clone() As CObject.CObject
            Return New ParticipantRegistrationClass()
        End Function

        Public Overrides ReadOnly Property Key As String
            Get
                Return "EventAttendeeId"
            End Get
        End Property

        Protected Overrides Function ProcedureSigniture(ByVal peCommandType As CObject.CommandType) As String
            Select Case peCommandType
                Case CommandType.SQLSelect
                    Return "EXEC CMT_GetRegQuestForEventAttendee {EventAttendeeId} "
                Case CommandType.SQLUpdate
                    Return "EXEC CMT_AddEventAttendeeRegDetails {EventAttendeeId}, {Q1}, {Q2}, {Q3}, {Q4}, {Q5}, {Q6}, {Q7}, {Q8}, {Q9}, {Q10}, {Q11}, {Q12}, {Q13}, {Q14}, {Q15}, {Q16}, {Q17}, {Q18}, {Q19}, {Q20}, {Q21}, {Q22}, {Q23}, {Q24}, {Q25}, {Q26}, {Q27}, {Q28}, {Q29}, {Q30}, {Q31}, {RegisteredBy} "
                Case Else
                    Throw New SystemException("Invalid Command Type")
            End Select
        End Function

        Public Overrides ReadOnly Property SourceDataBase As ConnectionServer.Connection.SourceDataBase
            Get
                Return Connection.SourceDataBase.CMT
            End Get
        End Property

#Region "properties"

        Public Property EventAttendeeId As Integer
            Get
                Return CastToInteger(GetProperty("EventAttendeeId"))
            End Get
            Set(ByVal value As Integer)
                SetProperty("EventAttendeeId", value)
            End Set
        End Property

        Public Property Name As String
            Get
                Return CastToString(GetProperty("Name"))
            End Get
            Set(ByVal value As String)
                SetProperty("Name", value)
            End Set
        End Property

        Public Property Code As String
            Get
                Return CastToString(GetProperty("Code"))
            End Get
            Set(ByVal value As String)
                SetProperty("Code", value)
            End Set
        End Property

        Public Property Answer As String
            Get
                Return CastToString(GetProperty("Answer"))
            End Get
            Set(ByVal value As String)
                SetProperty("Answer", value)
            End Set
        End Property

        Public Property Q1 As String
            Get
                Return CastToString(GetProperty("Q1"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q1", value)
            End Set
        End Property

        Public Property Q2 As String
            Get
                Return CastToString(GetProperty("Q2"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q2", value)
            End Set
        End Property

        Public Property Q3 As String
            Get
                Return CastToString(GetProperty("Q3"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q3", value)
            End Set
        End Property

        Public Property Q4 As String
            Get
                Return CastToString(GetProperty("Q4"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q4", value)
            End Set
        End Property

        Public Property Q5 As String
            Get
                Return CastToString(GetProperty("Q5"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q5", value)
            End Set
        End Property

        Public Property Q6 As String
            Get
                Return CastToString(GetProperty("Q6"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q6", value)
            End Set
        End Property

        Public Property Q7 As String
            Get
                Return CastToString(GetProperty("Q7"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q7", value)
            End Set
        End Property

        Public Property Q8 As String
            Get
                Return CastToString(GetProperty("Q8"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q8", value)
            End Set
        End Property

        Public Property Q9 As String
            Get
                Return CastToString(GetProperty("Q9"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q9", value)
            End Set
        End Property

        Public Property Q10 As String
            Get
                Return CastToString(GetProperty("Q10"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q10", value)
            End Set
        End Property

        Public Property Q11 As String
            Get
                Return CastToString(GetProperty("Q11"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q11", value)
            End Set
        End Property

        Public Property Q12 As String
            Get
                Return CastToString(GetProperty("Q12"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q12", value)
            End Set
        End Property

        Public Property Q13 As String
            Get
                Return CastToString(GetProperty("Q13"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q13", value)
            End Set
        End Property

        Public Property Q14 As String
            Get
                Return CastToString(GetProperty("Q14"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q14", value)
            End Set
        End Property

        Public Property Q15 As String
            Get
                Return CastToString(GetProperty("Q15"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q15", value)
            End Set
        End Property

        Public Property Q16 As String
            Get
                Return CastToString(GetProperty("Q16"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q16", value)
            End Set
        End Property

        Public Property Q17 As String
            Get
                Return CastToString(GetProperty("Q17"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q17", value)
            End Set
        End Property

        Public Property Q18 As String
            Get
                Return CastToString(GetProperty("Q18"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q18", value)
            End Set
        End Property

        Public Property Q19 As String
            Get
                Return CastToString(GetProperty("Q19"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q19", value)
            End Set
        End Property

        Public Property Q20 As String
            Get
                Return CastToString(GetProperty("Q20"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q20", value)
            End Set
        End Property

        Public Property Q21 As String
            Get
                Return CastToString(GetProperty("Q21"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q21", value)
            End Set
        End Property

        Public Property Q22 As String
            Get
                Return CastToString(GetProperty("Q22"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q22", value)
            End Set
        End Property

        Public Property Q23 As String
            Get
                Return CastToString(GetProperty("Q23"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q23", value)
            End Set
        End Property

        Public Property Q24 As String
            Get
                Return CastToString(GetProperty("Q24"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q24", value)
            End Set
        End Property

        Public Property Q25 As String
            Get
                Return CastToString(GetProperty("Q25"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q25", value)
            End Set
        End Property

        Public Property Q26 As String
            Get
                Return CastToString(GetProperty("Q26"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q26", value)
            End Set
        End Property

        Public Property Q27 As String
            Get
                Return CastToString(GetProperty("Q27"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q27", value)
            End Set
        End Property

        Public Property Q28 As String
            Get
                Return CastToString(GetProperty("Q28"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q28", value)
            End Set
        End Property

        Public Property Q29 As String
            Get
                Return CastToString(GetProperty("Q29"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q29", value)
            End Set
        End Property

        Public Property Q30 As String
            Get
                Return CastToString(GetProperty("Q30"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q30", value)
            End Set
        End Property

        Public Property Q31 As String
            Get
                Return CastToString(GetProperty("Q31"))
            End Get
            Set(ByVal value As String)
                SetProperty("Q31", value)
            End Set
        End Property

        Public Property RegisteredBy As String
            Get
                Return CastToString(GetProperty("RegisteredBy"))
            End Get
            Set(ByVal value As String)
                SetProperty("RegisteredBy", value)
            End Set
        End Property

#End Region

#Region "Methods"
        ''' <summary>
        ''' Method to get the meeting details.
        ''' </summary>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Function GetRegisteredParticipants(ByVal pEventId As Integer) As DataTable
            Using loConn As Connection = New Connection(Connection.SourceDataBase.CMT)
                Dim lsSQl As String = String.Empty
                Dim loDT As DataTable
                lsSQl = "EXEC CMT_GetRegiseredAttendeeDetails " + pEventId.ToString()
                loDT = loConn.GetDataTable(lsSQl)
                Return loDT
            End Using
        End Function

        ''' <summary>
        ''' Method to get all the attendee details of an event to export to XL.
        ''' </summary>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Function GetRegisteredParticipantsToExportToXL(ByVal pEventId As Integer) As DataTable
            Using loConn As Connection = New Connection(Connection.SourceDataBase.CMT)
                Dim lsSQl As String = String.Empty
                Dim loDT As DataTable
                lsSQl = "EXEC CMT_ExportParticipantDetails " + pEventId.ToString()
                loDT = loConn.GetDataTable(lsSQl)
                Return loDT
            End Using
        End Function
#End Region



    End Class
End Namespace
